package view;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Session;

import util.HibernateUtil;

import com.opensymphony.xwork2.ActionSupport;


public class LogOutAction extends ActionSupport {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	// all struts logic here
	@Override
	public String execute() {
		
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.close();
		
		ServletActionContext.getRequest().getSession().invalidate();
		addActionMessage("sesion finalizada !");
		return "logout";
	}
}
